package com.mazaiting.manager.convert;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.mazaiting.manager.domain.entity.SysDictType;
import com.mazaiting.manager.domain.form.DictTypeForm;
import com.mazaiting.manager.domain.vo.dict.DictTypePageVO;
import org.mapstruct.Mapper;
import org.mapstruct.MappingConstants;
import org.mapstruct.ReportingPolicy;

/**
 * 字典类型转换器
 *
 * @author mazaiting
 * @create_time 2022/9/22 23:55
 */
@Mapper(componentModel = MappingConstants.ComponentModel.SPRING, unmappedTargetPolicy = ReportingPolicy.IGNORE)
public interface IDictTypeConverter {

    /**
     * 实体转换为分页 VO
     * @param dictTypePage 实体数据
     * @return 分页 VO
     */
    Page<DictTypePageVO> entity2Page(Page<SysDictType> dictTypePage);

    /**
     * 实体转 VO
     * @param sysDictType 实体
     * @return VO
     */
    DictTypePageVO entity2Page(SysDictType sysDictType);

    /**
     * 表单转实体
     * @param dictTypeForm 字典类型表单
     * @return 实体
     */
    SysDictType form2Entity(DictTypeForm dictTypeForm);

    /**
     * 实体转表单
     * @param entity 实体
     * @return 表单
     */
    DictTypeForm entity2Form(SysDictType entity);
}
